﻿//a1. 编写程序，实现计算器功能。输入两个数字和一个运算符，打印出计算结果
using System;
public class computer
{
    public static void Main(string[] args)
    {
        int a, b;
        char c;
        string s = "";

        Console.WriteLine("请输入操作符号");
        c =(char)System.Console.Read();
         Console.ReadLine();


        Console.WriteLine("给操作数a赋值：");
        s = Console.ReadLine();
        a=int.Parse(s);


   
        System.Console.WriteLine("给操作数b赋值：");
        s = Console.ReadLine();
        b=int.Parse(s);


        switch (c)
        {
            case '+':System.Console.WriteLine(a + "+"+ b + "=" + (a + b)); break;
            case '-': System.Console.WriteLine((a) +"-"  + (b) + "=" + (a - b)); break;
            case '*': System.Console.WriteLine(a + "*"+ b + "=" + (a * b)); break;
            case '/': System.Console.WriteLine(a + "/" + b + "=" + (a / b)); break;
            case '%': System.Console.WriteLine(a + "%" + b + "=" + (a % b)); break;
            default: System.Console.WriteLine("暂不支持");break;
        }
          
    }
}